const request = require('../utils/request')

function getHome() {
    return request({
        url: '/api/kill',
        method:'get'
    })
}
// 秒杀的数据
function getKillList(data) {
    return request({
        url: '/api/killlist',
        method: 'post',
        data: {
            shopclass: data.shopclass
        }
    })
}
// 秒杀详情
function getKillDetail(data) {
    return request({
        url: "/api/killdetail",
        method: "post",
        data: {
            id: data.id
        }
    })
}
//秒杀加入购物车
function getKillAddShop(data) {
    console.log(data,'data');
    return request({
        url: "/api/killaddshop",
        method: 'post',
        data: {
            userId: data.userId,
            shopId: data.shopId,
            shopshow:data.shopshow
        }
    })
}

//// 秒杀购物车列表
function getKillCarList(data) {
    // console.log(data, '5555');
    return request({
        url: '/api/killcarlist',
        method: 'post',
        data: {
            userId: data.userId,
            shopId: data.shopId
        }
    })
}
// 拼团
function getPinShop(params) {
    console.log(params,'params');
    return request({
        url: '/api/shop',
        method: 'get',
        params
    })
}

// 获取拼团数居
function getpinShopList() {
    return request({
        url: "/api/getpinShop",
        method: "post"
    })
}
// 拼团详情
function getpinDetailList(data) {
    return request({
        url: "/api/getpinDetail",
        method: "post",
        data: {
            id: data.id
        }
    })
}

// 拼团详情--加入购物车
function getDetailAdd(data) {
    // console.log(data,'data');
    return request({
        url: "/api/getDetailAdd",
        method: "post",
        data: {
            shopId: data.shopId,
            userId: data.userId,
            shopshow:data.shopshow
        }
    })
}


// 购物车删除数据
function getShopDel(id){
    return request({
        url:"/api/getShopDelete",
        method:"post",
        data:{id:id.id}
    })
}
function getList() {
    return request({
        url: '/api/shop'
    })
}

// 分类数据
function getShopList() {
    return request({
        url: '/api/shoplist',
        method: 'get'
    })
}

//砍价列表数据
function getBargain_zjg(){
    return request({
        url:'/api/bargain',
        method:'get',
    })
}
// 获取数据库的地址
function getShopAddress() {
    return request({
        url: "/api/getShopAddress",
        method: "post",
    })
}
// 分类详情
function getDetail_zjg(data) {
    return request({
        url: '/api/detail',
        data
    })
}

//修改购物车数量
function getShopNumList(data){
    return request({
        url:"/api/getShopNum",
        method:"post",
        data:{id:data.numid,count:data.numNum}
    })
}

// 评价数据
function getEvaluat(){
    return request({
        url:'/api/evaluat',
        method:'get'
    })
}

//订单付款
function getOrder(data) {
    return request({
        url: "/api/ordershop",
        method: 'post',
        data:{
            configuration:data.listPrice[0].configuration,
            content:data.listPrice[0].content,
            count:data.listPrice[0].count,
            create_time:data.listPrice[0].create_time,
            img:data.listPrice[0].img,
            kills:data.listPrice[0].kills,
            killstate:data.listPrice[0].killstate,
            limits:data.listPrice[0].limits,
            limitstate:data.listPrice[0].limitstate,
            original:data.listPrice[0].original,
            price:data.listPrice[0].price,
            selected:data.listPrice[0].selected,
            shopId:data.listPrice[0].shopId,
            shopclass:data.listPrice[0].shopclass,
            shopshow:data.listPrice[0].shopshow,
            state:data.listPrice[0].state,
            title:data.listPrice[0].title,
            userId:data.listPrice[0].userId,
            status:data.listPrice[0].status
        }
    })
}

module.exports = {
    getHome,
    getKillList,
    getPinShop,
    getList,
    getpinShopList,
    getpinDetailList,
    getDetailAdd,
    getShopDel,
    getShopNumList,
    getShopAddress,
    getKillDetail,
    getKillAddShop,
    getKillCarList,
    getShopList,
    getDetail_zjg,
    getBargain_zjg,
    getEvaluat,
    getOrder,
}